package com.itheima.forwhile;

public class ForAndWhile {

    public static void main(String[] args) {
        System.out.println(whileTest());
    }
    public static void forTest() {
    }
    public static int whileTest() {
        //目标复利计算
        double money = 10000;
        int year = 0;
        double rate = 0.017;
        while(money < 20000){
            money *= (1 + rate);
            year++;
        }
        return year;
    }
}
